#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
#define ll long long
#define sc scanf
#define pf printf
#define maxn 100050

struct N{
	int s,e;
}n[maxn];

bool cmp1(N a,N b){
	if(a.s<b.s)return true;
	else return false;
}

struct W{
	int s,e;
}w[maxn];

bool cmp2(W a,W b){
	if(a.s<b.s)return true;
	else return false;
}

int L[maxn],n1,m1,m2,nei[maxn],wai[maxn];

int main(){
	freopen("airport.in","r",stdin);
	freopen("airport.out","w",stdout);
	sc("%d%d%d",&n1,&m1,&m2);
	for(int i=1;i<=m1;i++){
		sc("%d%d",&n[i].s,&n[i].e);
	}
	sort(n+1,n+m1+1,cmp1);
	for(int i=1;i<=m2;i++){
		sc("%d%d",&w[i].s,&w[i].e);
	}
	sort(w+1,w+m2+1,cmp2);
	int ans,cnt1,cnt2;
    for(int i=0;i<=n1;i++){
    	nei[i]=i,wai[i]=n1-i;
	}
	int cnt=0;
	for(int i=0;i<=n1;i++){
		cnt1=nei[i],cnt2=wai[i];
		for(int j=1;j<=nei[i];j++){
			L[j]=n[j].e;
		}
		for(int j2=nei[i]+1;j2<=m1;j2++){//!!!
			for(int j3=1;j3<=nei[i];j3++){
				if(n[j2].s>L[j3]){
					L[j3]=n[j2].e;
					cnt1++;
					break;
				}
			}
		}
		for(int j=1;j<=wai[i];j++){
			L[nei[i]+j]=w[j].e;
		}
		for(int j2=wai[i]+1;j2<=m2;j2++){
			for(int j3=nei[i]+1;j3<=n1;j3++){
				if(w[j2].s>L[j3]){
					L[j3]=w[j2].e;
					cnt2++;
					break;
				}
			}
		}
		cnt=max(cnt,cnt1+cnt2);
	}
	cout<<cnt;
	return 0;
}
